<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDriverCarTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('driver_car', function (Blueprint $table) {
            $table->bigInteger('car_id')->index()->comment('车辆ID');
            $table->bigInteger('driver_id')->index()->comment('司机ID');
            $table->enum('host', [0, 1])->default(1)->comment('是否主司机');
        });
        \DB::statement("ALTER TABLE `driver_car` comment '司机车辆关联表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('driver_car');
    }
}
